/////////////////////////////////////////////////////////////////////////////
// Copyright(c) 2012-2015 sumscope All Rights Reserved
// Name:        message_bond.h
// Purpose:     
// Author:      syy
// Modified by: 
// Created:     2015/2/10 16:01
// RCS-ID:      
// Licence:     
/////////////////////////////////////////////////////////////////////////////
#ifndef _MESSAGE_BOND_H_
#define _MESSAGE_BOND_H_

#include "core/common_types.h"
#include "core/comdefs.h"
#include "qbnet/include/network_service.h"
#include "message_kernel.h"
#include <qbprotocol/include/ProtoAdaptor.h>
#include <qbprotocol/include/MessageParser.h>
#include <qbprotocol/include/SSMsgStruct.h>
#include <functional>

// {F8D8B9D9-9FB6-4f60-89E6-B8F17EAFA1FD}
DEFINE_GUID(IID_IMessageBond,
			0xf8d8b9d9, 0x9fb6, 0x4f60, 0x89, 0xe6, 0xb8, 0xf1, 0x7e, 0xaf, 0xa1, 0xfd);

#ifdef __cplusplus
extern "C" {
#endif

	DECLARE_INTERFACE(IQpidMessageProcessor)
	{
		STDMETHOD_(void, OnResponse) (THIS_ int32_t funcId, const qb::SSAckMsg&) PURE; //TODO const SSAckMsg&?
	};

    DECLARE_INTERFACE_(IMessageBond, IUnknown)
	{
		STDMETHOD_(int32_t,Create) (THIS_ INetworkService* ins, IMessageKernel* kernel, IMessageProcess* process) PURE;
		STDMETHOD_(int32_t,Destory) (THIS_) PURE;
		STDMETHOD_(bool, RegisterDecodeFunc) (THIS_ int, qb::DecodeFunc) PURE;
		STDMETHOD_(bool, RegisterMsgProcessor) (THIS_ int, IQpidMessageProcessor*) PURE;
		STDMETHOD_(bool, UnRegisterMsgProcessor) (THIS_ int, IQpidMessageProcessor*) PURE;
		STDMETHOD_(void, SetSpecificMsgProcessor) (IQpidMessageProcessor*) PURE;
	};

#ifdef __cplusplus
}
#endif

#endif // _MESSAGE_BOND_H_
